// pages/edu/exam/category/index.js
import { ExamCategory } from '../../model/exam_category.js'
const ExamCategoryModel=new ExamCategory()

Page({

  /**
   * 页面的初始数据
   */
  data: {
    id:0,
    category:{},
    is_auth:true,
    describe:'暂无数据',
  },

  /**
   * 生命周期函数--监听页面加载
   */
  onLoad: function (options) {
    this.setData({
      id:options.id
    })

    wx.setNavigationBarTitle({
      title: '分类-艾族大学'
    });
    this._getChildList()
  },

  /**
   * 用户点击右上角分享
   */
  onShareAppMessage: function () {

  },

  //-------------------------------
  
  /**
   * 职位列表
   */
  _getChildList(){
    let id=this.data.id
    ExamCategoryModel.getChildList(id,(res)=>{
      this.setData({
        category:res
      })
    },(res)=>{
      if(res.msg_code==80004){
        this.setData({is_auth:false,'describe':res.msg})
      }
    })
  },

  /**
   * 职位考核跳转
   * @param {*} event 
   */
  onJobsLink:function(event){
    let id=event.currentTarget.dataset.id
    wx.navigateTo({
      url: '../jobs/index?id='+id
    });
  },

})